package acwing._2LanQiao._5BinaryIndexedTree_SegmentTree;
/**
 * @Project : ProgrammingExercises
 * @Package : ACWing._2LanQiao._5BinaryIndexedTree_SegmentTree
 * @File : Q1264_2.java
 * @Author : WangRuoyu
 * @Date : 2023/3/17 10:20
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Q1264_2 {
    static int[] A;
    static int n;
    static int m;
    static segmentTreeSum[] tree;

    static void pushup(int u) {
        tree[u].sum = tree[u << 1].sum + tree[u << 1 | 1].sum;
    }

    static void build(int u, int l, int r) {
        if (l == r) {
            tree[u] = new segmentTreeSum(l, r, A[l]);
        } else {
            tree[u] = new segmentTreeSum(l, r, 0);
            int mid = (l + r) >> 1;
            build(u << 1, l, mid);
            build(u << 1 | 1, mid + 1, r);
            pushup(u);
        }
    }

    static int query(int u, int l, int r) {
        if (tree[u].l >= l && tree[u].r <= r) {
            return tree[u].sum;
        }
        int mid = (tree[u].l + tree[u].r) >> 1;
        int sum = 0;
        if (l <= mid) sum += query(u << 1, l, r);
        if (r > mid) sum += query(u << 1 | 1, l, r);
        return sum;
    }

    static void modify(int u, int x, int v) {
        if (tree[u].l == tree[u].r) {
            tree[u].sum += v;
            return;
        }
        int mid = (tree[u].l + tree[u].r) >> 1;
        if (x <= mid) modify(u << 1, x, v);
        else modify(u << 1 | 1, x, v);
        pushup(u);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");

        n = Integer.parseInt(words[0]);
        m = Integer.parseInt(words[1]);
        A = new int[n + 1];
        tree = new segmentTreeSum[4 * n + 1];

        words = br.readLine().split(" ");
        for (int i = 1; i <= n; ++i) {
            A[i] = Integer.parseInt(words[i - 1]);
        }

        build(1, 1, n);

        for (int i = 0; i < m; ++i) {
            words = br.readLine().split(" ");
            int k = Integer.parseInt(words[0]);
            int a = Integer.parseInt(words[1]);
            int b = Integer.parseInt(words[2]);

            if (k == 0) {
                System.out.println(query(1, a, b));
            } else {
                modify(1, a, b);
            }
        }
    }
}